package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsHomeAdv;
import com.wuxiaofan.coupon.entity.custom.SmsHomeAdvCustom;
import com.wuxiaofan.coupon.mapper.SmsHomeAdvMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsHomeAdvService {
    @Autowired
    private SmsHomeAdvMapper smsHomeAdvMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsHomeAdv findById(String id){
        return smsHomeAdvMapper.selectById(id);
    }

    public SmsHomeAdvCustom findCountByMap(Map paraMap){
        return smsHomeAdvMapper.findCountByMap(paraMap);
    }

    public SmsHomeAdvCustom findGroupByMap(Map paraMap){
        return smsHomeAdvMapper.findGroupByMap(paraMap);
    }

    public List<SmsHomeAdvCustom> findByMap(Map paraMap){
        return smsHomeAdvMapper.findByMap(paraMap);
    }

    public Page<SmsHomeAdvCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsHomeAdvMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsHomeAdvMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsHomeAdvMapper.deleteById(id);
    }

    public SmsHomeAdv save(SmsHomeAdv smsHomeAdv){
        smsHomeAdv.setId(idgenerator.getId());
        smsHomeAdvMapper.insert(smsHomeAdv);
        return smsHomeAdv;
    }

}
